/**
 * Created by Administrator on 2017/3/26.
 */

let Vue=require('com/vue')
import Router from 'vue-router'
// let Router=require('vue-router')


Vue.use(Router);

import {routes} from 'js/index_routes'

const router=new Router({
    /*mode:'history',*/  //url去掉#
    routes:routes,
    history:true

})

//router全局钩子
//还可以某个路由独享某个钩子 routes[0].beforeEnter
router.beforeEach((to,from,next)=>{
   // 读配置文件匹配
    if(to.path=='/') next(routes[0].path)
    if(localStorage.getItem('location_manage_web_token')) next()
    else window.location.href='login.html'

})


export default router